/* -----------------------------------------------------------
 * Author: Maria Powell
 * Testing Function: isGameOver()
 * Function Description: Function determines when and if the 
 * 						 game is over based on the following
 * 						 criteria:
 * 						 - province card stack is empty
 * 						 - 3 supply pile stacks are empty
 * What to test: This unit test will test if the function will 
 * 				 return true that the game is over once the
 * 				 province stack is empty.
 * How to test:  I will set the game state properly so that
 * 				 province indicated a empty.
 -----------------------------------------------------------*/

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

//Set NOISY test to 0 to remove printfs from output console
#define NOISY_TEST 1

int main()
{
	//Initialization
	struct gameState G;
	int zero = 0;	
	int _true_ = 1;
	int returnIsGameOver = 0;

	printf("TESTING  isGameOver()\n");
	#if (NOISY_TEST == 1)
		printf("Setting gameState Values:\n");
		printf("Supply Count of Province Set to 0\n");
	#endif

	//clear gameState 
	memset(&G, 23, sizeof(struct gameState)); 
	
	//setting gameState values
	G.supplyCount[province] = zero;
	
	//Testing isGameOver()
	#if (NOISY_TEST == 1)
		printf("Calling isGameOver()...\n");
	#endif 	
	returnIsGameOver = isGameOver(&G);
	assert(returnIsGameOver == _true_);

	printf("Unit Test Passed\n");
}
